package com.example.controller;

import com.example.bean.ConfigBean;
import com.example.bean.User;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: my-spring-boot
 * @description: LucyController
 * @author: JackDong
 * @create: 2018-04-09 16:48
 **/
@RestController
@EnableConfigurationProperties({ConfigBean.class})
public class LucyController {

    @Autowired
    ConfigBean configBean;

    @ApiOperation(value="读取配置文件", notes="读取配置文件")
    @RequestMapping(value = "/lucy",method = RequestMethod.GET)
    public String miya(){
        return configBean.getGreeting()+" >>>>"+configBean.getName()+" >>>>"+ configBean.getUuid()+" >>>>"+configBean.getMax();
    }

    @Autowired
    User user;

    @ApiOperation(value="读取配置文件", notes="读取配置文件")
    @RequestMapping(value = "/user",method = RequestMethod.GET)
    public String user(){
        return user.getName() + ":" +user.getAge();
    }
}
